﻿/*****************************************************************************
	SNEGA STG GAME ENGINE 0.7a
	Copyright (C) 2009, Xiaohan Tian (snega0223)
	
	http://code.google.com/p/sng-actionscript-stg-engine/
	
	This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License(LGPL) as
	published by the Free Software Foundation, either version 3 of the 
	License, or(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/

package com.sng.stg.game.event 
{
	import com.sng.stg.game.StageViewer;
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author snega
	 */
	public class ContinuousEvent extends Sprite
	{
		public var _stage:StageViewer = null;
		
		public var _previous:ContinuousEvent = null;
		public var _next:ContinuousEvent = null;
		
		public function ContinuousEvent() 
		{
			
		}
		
		public function push(o:ContinuousEvent):void {
			if (this._next == null) {
				o._previous = this;
				
				this._next = o;
			}
			else {
				this._next._previous = o;
				
				o._next = this._next;
				o._previous = this;
				
				this._next = o;
			}
		}
		
		public function pushToEnd(o:ContinuousEvent):void {
			if (this._next == null) {
				o._previous = this;
				
				this._next = o;
			}
			else {
				var o2:ContinuousEvent = this._next;
				while (o2._next != null) {
					o2 = o2._next
				}
				
				o2._next = o;
				o._previous = o2;
			}
		}
		
		public function remove():void {
			if (this._next != null) {
				this._next._previous = this._previous;
			}
			
			if (this._previous != null) {
				this._previous._next = this._next;
			}
		}
		
		public function start(stage:StageViewer):void {
			this._stage = stage;
		}
		
		public function process():void {
			
		}
		
	}
	
}